package com.xxxx.springMVC.day16;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.yaml.snakeyaml.Yaml;

@Slf4j
@Controller
public class Controller1 {

    @GetMapping("/test1")
    public ModelAndView test1(){
        log.info("test1()");
        return null;
    }

    @PostMapping("/test2")
    public ModelAndView test2(@RequestParam("name") String name){
        log.info("test2({})",name);
        return null;
    }

    @PostMapping("/test3")
    public ModelAndView test3(@Token String token,String name){
        System.out.println(name);
        log.info("test3({})",token);
        return null;
    }

    @RequestMapping("/test4")
    @Yml
    public User test4(){
        log.info("test4");
        return new User("张三",18);
    }

    public static void main(String[] args) {
        String str = new Yaml().dump(new User("张三", 18));
        System.out.println(str);
    }
}
